﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Dare.Utilities.Net.FTPClient
{
    public enum FtpOperateCommandType
    {
        None,
        Connect,
        Disconnect,
        UploadFile,
        DownloadFile,
        CreateFile,
        DeleteFile,
        MoveFile,
        RenameFile,
        ListDir,
        CreateDir,
        DelDir,
        MoveDir,
        RenameDir,
        ChangeDir,
    }

    public class FtpOperate
    {
        private FtpOperateCommandType cmd;
        private string localFileName;
        private long localFileLength;
        private string remoteFileName;
        private long remoteFileLength;
        private string remoteDir;
        private DateTime startTime;

        public FtpOperateCommandType CurrentCommand
        {
            get { return cmd; }
        }

        public string LocalFileName
        {
            get { return localFileName; }
            set { localFileName = value; }
        }

        public long LocalFileLength
        {
            get { return localFileLength; }
            set { localFileLength = value; }
        }

        public string RemoteFileName
        {
            get { return remoteFileName; }
            set { remoteFileName = value; }
        }

        public long RemoteFileLength
        {
            get { return remoteFileLength; }
            set { remoteFileLength = value; }
        }

        public string RemoteDir
        {
            get { return remoteDir; }
            set { remoteDir = value; }
        }

        public DateTime StartTime
        {
            get { return startTime; }
        }

        public FtpOperate()
        {
            cmd = FtpOperateCommandType.None;
            localFileName = String.Empty;
            localFileLength = 0;
            remoteDir = String.Empty;
            remoteFileName = String.Empty;
            remoteFileLength = 0;
            startTime = System.DateTime.MinValue;
        }

        public void BeginOperation(FtpOperateCommandType opCmd)
        {
            cmd = opCmd;
            localFileName = String.Empty;
            localFileLength = 0;
            remoteDir = String.Empty;
            remoteFileName = String.Empty;
            remoteFileLength = 0;
            startTime = System.DateTime.Now;
        }

        public void EndOperation()
        {
            cmd = FtpOperateCommandType.None;
            localFileName = String.Empty;
            localFileLength = 0;
            remoteDir = String.Empty;
            remoteFileName = String.Empty;
            remoteFileLength = 0;
            startTime = System.DateTime.Now;
        }
    }
}
